<?php

namespace App\Jobs;

use App\Mail\SendEmail;
use App\Model\Admin\MessageModel;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Mail;

class SendEmailMessage implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    protected $message;

    protected $to = '690344297@qq.com';

    /**
     * SendEmailMessage constructor.
     * @param array $message
     */
    public function __construct($message = [])
    {
        $this->message = $message;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        //
        $message = $this->message;

        $SendEmail = new SendEmail('网站留言通知','emails.message', $message);

        Mail::to($this->to)->send($SendEmail);
    }
}
